;(function(){
  'use strict';
  angular.module('controllers.oldOMDisplay.upayQM')
  .controller('tradeCompletionCtrl', tradeCompletionCtrl);

  function tradeCompletionCtrl($scope,UpayTradeComplSelector,UpayTradeComplQueryParam){
  	$scope.selector = UpayTradeComplSelector.setSelector();
  	$scope.flag = UpayTradeComplQueryParam.initFlag();
  	$scope.tradeCompl = UpayTradeComplQueryParam.initParam();
  	$scope.date = UpayTradeComplQueryParam.initDate();

  	$scope.$watch('tradeCompl.timeType',function(n,o){
      if(n === o) return;
      $scope.date = UpayTradeComplQueryParam.initDate();
  	},true);

  	$scope.$watch('tradeCompl.agencyType',function(n,o){
      if(n === o) return;
      $scope.selector = UpayTradeComplSelector.setSelector(n.code);
  	}); 

  	$scope.tradeComplQuery = UpayTradeComplQueryParam.tradeCompletionQueryFn;
  }
  
  tradeCompletionCtrl.$inject = ['$scope','UpayTradeComplSelector','UpayTradeComplQueryParam'];

})();